<template>
  <div class="app-footer">
    <div class="top">
      <img src="/images/common/logo.png">
      <div class="list">
        <div
          class="list-item"
          v-for="(item, index) in list"
          :key="index">
          <div class="title">{{ item.label }}</div>
          <div class="li-box">
            <div
              class="li-item"
              v-for="(i, ids) in item.children"
              :key="`${ index }-${ ids }`">
              {{ i.label }}
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="bottom">
      <div>Copyright © 2023 houlangduoduo.com. All rights reserved</div>
      <div class="right flex">
        <div
          class="router-item"
          :class="{ active: item.key === (route?.path || '/') }"
          v-for="item in routerArr"
          :key="item.key">
          <NuxtLink :to="item.key">{{ item.label }}</NuxtLink>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
const props = defineProps({
  path: { type: String, default: '/' }
})

const route = useRoute()
const list = [
  {
    label: 'Products',
    children: [
      { label: 'Ball Bearings' },
      { label: 'Roller Bearings' },
      { label: 'Thrust Bearings' },
      { label: 'Pillow Block Bearings' },
    ]
  },
  {
    label: 'Industries',
    children: [
      { label: 'Automotive' },
      { label: 'Aerospace' },
      { label: 'Agriculture' },
      { label: 'Energy and Utilities' },
    ]
  },
  {
    label: 'Follow us',
    children: [
      { label: 'Automotive' },
      { label: 'Aerospace' },
      { label: 'Agriculture' },
      { label: 'Energy and Utilities' },
    ]
  },
]

const routerArr = computed(() => RouterList.filter(item => item.key !== (route.path || '/')))
</script>

<style lang="less" scoped>
.app-footer {
  width: 12.13rem;
  height: 3.83rem;

  .top {
    height: 3.33rem;
    width: 100%;
    border-bottom: 0.01rem solid #D8C7C3;
    display: flex;
    align-items: flex-start;

    img {
      width: 1.68rem;
      height: 0.47rem;
      margin-right: 3.18rem;
    }

    .list {
      display: flex;
      flex: 1;

      .list-item {
        flex: 1;
        color: #8F7474;
        height: 2.22rem;
        display: flex;
        justify-content: space-between;
        flex-direction: column;

        .title {
          font-size: .2rem;
          font-weight: 600;
        }

        .li-box {
          font-size: .14rem;

          .li-item {
            line-height: .4rem;
            font-weight: 300;
          }
        }
      }
    }
  }

  .bottom {
    height: 0.49rem;
    padding-top: .29rem;
    font-size: .14rem;
    color: #8F7474;
    display: flex;
    justify-content: space-between;

    .right {
      .router-item {
        margin-right: .24rem;

        a {
          color: #8F7474;
        }

        &:last-child {
          margin-right: 0;
        }
      }
    }
  }
}
</style>
